Centralized Configuration Management with Hot-Reload and Validation - #244
Merged
JamesEjembi merged 1 commit intoAug 30, 2026
Conversation
…on, versioning and rollback (closes VeriNode-Labs#204) - Versioned config history with re-validated rollback to any prior version - Secret masking (/secret|password|key/i) for logs, metrics and API responses - Prometheus metrics: config_reload_count, config_validation_errors_total, config_rollbacks_total - etcd prefix watch via v3 HTTP gateway with mod_revision change cursor - Management API routes: GET/PUT /config, POST /config/reload, POST /config/rollback/:version - Wire management routes into index.js after config init
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #204
Summary
Implements centralized configuration management with layered sources, JSON Schema validation, hot-reload propagation, versioning with rollback, secret masking, and a management API.
What's included
New modules in
src/config/versions.ts—ConfigVersionHistory: immutable versioned history of every applied config change (initial load, reload, update, delete, rollback), with retention trimming and monotonic version numbering.secrets.ts— Secret masking: values under key paths matching/secret|password|key/iare masked (****) in logs, metrics, and API responses viamaskSecrets()/safeConfigForLog().metrics.ts— Prometheus counters:config_reload_count,config_validation_errors_total,config_rollbacks_total, plus last-reload-duration gauge.etcd_watch.ts—EtcdConfigWatcher: polls the etcd v3 HTTP gateway under/config/{service}/prefix with a monotonicmod_revisioncursor, decodes slash-path keys into nested config, and invokes change callbacks for propagation.routes.ts— Management API:GET /config,PUT /config,POST /config/reload,POST /config/rollback/:version,GET /config/versions,GET /config/metrics. All responses secret-masked.ConfigManager extensions
rollbackTo(version)— re-validates the historical snapshot against the current schema before reapplying (handles schema evolution); failed rollback leaves running config untouched.triggerReloadAsync()— promise-based reload for the API; existing debouncedtriggerReload()(50ms, under the 100ms propagation target) unchanged.Wiring
index.jsregisters the management routes after config init.src/config/index.tsexports all new modules.Tests
tests/config/config_extensions.test.tscovering: version history recording/retention/lookup, rollback with re-validation, failed-rollback safety, secret key detection/masking/log safety, and metrics counters + Prometheus output.npm testexit code 0) andnpm run buildis clean.